/**
 * 统计生产线和设备
 */

dev.action = function(resp,param){

    var spaceName = param.workSpaceName;
    var name = param.name;
    // 获取能源架构ID
    var workSpace = iot.getEnergySpaceId(spaceName,name);
    if (workSpace === -1){
        resp.setJsData("找不到数据");
        return;
    }
    var db = iot.db();
    // 找到生产线
    var productionLine = db.queryOne("select count(*) as productionLine from energy_struc where pid = " + workSpace);
    // 找到设备
    var dev = db.queryOne("select count(*) as dev FROM energy_struc where pid in (select id from energy_struc where pid = "+ workSpace +")");
    var result = {
        "productionLine" : productionLine.productionLine,
        "dev" : dev.dev
    }
    resp.setJsData(result);
}